package com.education.welco.controller.app;


import com.github.pagehelper.PageHelper;
import com.education.common.core.BaseController;
import com.education.common.utils.ApiReturnObject;
import com.education.welco.pojo.LPaper;
import com.education.welco.pojo.LQuestions;
import com.education.welco.pojo.SCatalogQuestions;
import com.education.welco.service.ILQuestionsService;
import com.education.welco.service.ISCatalogQuestionsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 试卷试题 信息操作处理
 *
 * @author d
 * @date 2020-05-08
 */
@Api(tags = {"平台课程--模拟测试-试题"})
@RestController
@RequestMapping("/app/lQuestions")
public class AppLQuestionsController extends BaseController {

    @Autowired
    private ILQuestionsService questionsService;


    @ApiOperation(value = "平台课程--试题接口", httpMethod = "GET")
    @GetMapping("/findByQuestions")
    public ApiReturnObject findByPaper(Integer paperId) {
        if (paperId == null){
            return new ApiReturnObject("200", "catalog不存在", "catalog不存在");
        }else {
            List<LQuestions> questionsList = questionsService.selectByPaperId(paperId);
            return new ApiReturnObject("200", "查询成功", questionsList.size(),questionsList);
        }
    }

}